/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LyricsHandler_P.java
 *
 * Created on 10/01/2012, 12:21:28 PM
 */
package Clases;

import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileReader;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Jose
 */
public class LyricsHandler_P extends javax.swing.JFrame {
    public static final int FORM_REDUCIDO=530;//520;
    public static final int FORM_EXTENDIDO=715;
    private LinkedList<Object[]> Artistas,Albums;
    private LinkedList<Cancion> ConsultaLetra, ConsultaEspecifica;
    private Cancion CancionActual;
    private Hilo Temporizador;
    
    /** Creates new form LyricsHandler_P */
    public LyricsHandler_P() {
        initComponents();        
        setSize(this.getWidth()-60, FORM_REDUCIDO);
        setLocationRelativeTo(null);
        jPanel1.setSize(jPanel1.getPreferredSize());
        jInternalFrame1.setClosable(true);
        jInternalFrame2.setClosable(true);
        jTextField1.setText("");
        jTextField2.setText("");
        jTextField3.setText("");
        jTextField4.setText(""); 
        jTextField5.setText(""); 
        Artistas=new LinkedList();
        Albums=new LinkedList();  
        ConsultaLetra=new LinkedList();
        ConsultaEspecifica=new LinkedList();
        CancionActual=null;          
        CargarDatos();
        ConsultaEspecifica();        
        IniciarHilo();       
        
        jTextField5.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                ConsultaEspecifica();
            }
        });
        
        jButton4.setEnabled(false);
    }
    
    public void IniciarHilo(){
        Temporizador=new Hilo(this);
        Temporizador.start();
    }
    
    /**
     * Este método abre una ventana al usuario donde éste especifica el
     * archivo SQLC que desea que se muestre en el area de texto.
     */
    public void SeleccionarPresentacion(){
        JFileChooser AbrirDialogo= new JFileChooser();
        int TipoSeleccion;

        AbrirDialogo.addChoosableFileFilter(
                new MyFileFilter(new String[]{"ppt","pptx"},"Presentación Power Point"));

        AbrirDialogo.setAcceptAllFileFilterUsed(false);
        AbrirDialogo.setFileHidingEnabled(false);
        AbrirDialogo.setFileSelectionMode(JFileChooser.FILES_ONLY);

        TipoSeleccion=AbrirDialogo.showOpenDialog(null);

        if(AbrirDialogo.getSelectedFile()!=null && TipoSeleccion!=JFileChooser.CANCEL_OPTION){            
            FileReader fr=null;            
            try{                                
                jTextField2.setText(AbrirDialogo.getSelectedFile().getPath());
                jButton4.setEnabled(true);
            }catch(Exception e){
                e.printStackTrace();
            }finally{
                try{
                    if(null!=fr){
                        fr.close();
                    }
                }catch(Exception e2){
                    e2.printStackTrace();
                }
            }

        }
    }

    public Connection AbrirConexion() {        
        try {            
            
            
            File f = new File(System.getProperty("user.dir"));             
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");            
            Connection conexion = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+
                    f.getPath()+"//Database.accdb;PWD=jesussavedme");              
            
//            String ruta=LyricsHandler_P.class.getProtectionDomain().getCodeSource().getLocation().toString();
//            ruta=ruta.substring(0, ruta.length() - 17);            
//            ruta=ruta.substring(6, ruta.length()-1);
//            Connection conexion = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+
//                    ruta+"/Database.accdb;PWD=jesussavedme"); 
                                    
            System.out.println("Conexion abierta");            
            return conexion;
        } catch (Exception e) {
            System.out.println("No se ha podido cargar el Driver JDBC-ODBC");
            e.printStackTrace();
            return null;
        }
    }
 
    public void CerrarConexion(Connection conexion) {
        try {            
            conexion.close();
            System.out.println("Conexión Cerrada");
        } catch (SQLException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
    
    private void CargarDatos(){
        try {
            Connection con=AbrirConexion();
            Statement st=con.createStatement();
            
            //Cargando Artistas
            ResultSet rs = st.executeQuery("select * from ARTISTA order by nombre;");            
            while ( rs.next() )
            {
                Object[] A=new Object[]{rs.getInt(1),rs.getString(2)};
                Artistas.add(A);
                jComboBox1.addItem(A[1].toString());
            }
            
            //Cargando Albums
            rs = st.executeQuery("select * from ALBUM order by nombre");            
            while ( rs.next() )
            {
                Object[] A=new Object[]{rs.getInt(1),rs.getString(2)};
                Albums.add(A);
                jComboBox2.addItem(A[1].toString());
            }
            
            CerrarConexion(con);
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
    
    private void AgregarArtista(){
        if(jTextField3.getText().isEmpty()){
            JOptionPane.showMessageDialog( this,
                "Debe ingresar el nombre del artista.",
                "Error Guardando",
                JOptionPane.ERROR_MESSAGE );
        }else{
            try {
                Connection con=AbrirConexion();
                Statement st=con.createStatement();
                int id=Artistas.size();                
                st.execute("INSERT INTO ARTISTA VALUES("+id+",'"+jTextField3.getText().trim()+"')");
                jComboBox1.addItem(jTextField3.getText().trim());
                Artistas.add(new Object[]{id,jTextField3.getText().trim()});
                jComboBox1.setSelectedIndex(jComboBox1.getItemCount()-1);
                JOptionPane.showMessageDialog( jInternalFrame1,
                    "Artista creado exitosamente.",
                    "Crear Artista",
                    JOptionPane.INFORMATION_MESSAGE);
                jInternalFrame1.hide();                

                CerrarConexion(con);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }
    }
    
    private void AgregarAlbum(){
        if(jTextField4.getText().isEmpty()){
            JOptionPane.showMessageDialog( this,
                "Debe ingresar el nombre del album.",
                "Error Guardando",
                JOptionPane.ERROR_MESSAGE );
        }else{
            try {
                Connection con=AbrirConexion();
                Statement st=con.createStatement();

                int id=Albums.size();
                st.execute("INSERT INTO ALBUM VALUES("+id+",'"+jTextField4.getText().trim()+"')");
                jComboBox2.addItem(jTextField4.getText().trim());
                Albums.add(new Object[]{id,jTextField4.getText().trim()});
                jComboBox2.setSelectedIndex(jComboBox2.getItemCount()-1);
                JOptionPane.showMessageDialog( jInternalFrame2,
                    "Album creado exitosamente.",
                    "Crear Album",
                    JOptionPane.INFORMATION_MESSAGE);
                jInternalFrame2.hide();                

                CerrarConexion(con);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }
    }
    
    private void GuardarCancion(){
        if(jTextArea1.getText().isEmpty()){
            JOptionPane.showMessageDialog( jInternalFrame1,
                    "No puede crearse o modificarse una canción sin letra.",
                    "Error",
                    JOptionPane.ERROR_MESSAGE);
        }else{            
            Connection con=AbrirConexion();        
            if(CancionActual==null){
                try {
                    Statement st=con.createStatement();
                    int id=0;                    
                    ResultSet rs=st.executeQuery(
                            "SELECT (Max(id_cancion)+1)"
                            + "FROM CANCION;");
                    rs.next();                    
                    id=rs.getInt(1);
                    
                    st.execute("INSERT INTO CANCION VALUES("+id+",'"+jTextField1.getText().trim()+
                            "',"+Artistas.get(jComboBox1.getSelectedIndex())[0] +","+Albums.get(jComboBox2.getSelectedIndex())[0]+
                            ",'"+jTextArea1.getText().trim()+"','"+jTextField2.getText().trim()+"')");
                    
                    CancionActual=new Cancion();
                    CancionActual.Id=id;
                    CancionActual.Nombre=jTextField1.getText().trim();
                    CancionActual.Autor=(Integer)Artistas.get(jComboBox1.getSelectedIndex())[0];
                    CancionActual.Album=(Integer)Albums.get(jComboBox2.getSelectedIndex())[0];
                    CancionActual.Letra=jTextArea1.getText().trim();
                    CancionActual.PP=jTextField2.getText().trim();
                    jButton4.setEnabled(false);
                    JOptionPane.showMessageDialog( jInternalFrame1,
                        "La canción se ha almacenado exitosamente.",
                        "Guardar Canción",
                    JOptionPane.INFORMATION_MESSAGE);
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }else{
                try {
                    Statement st=con.createStatement();
                                                            
                    st.execute("UPDATE CANCION SET nombre='"+jTextField1.getText().trim()+
                            "',[autor]="+Artistas.get(jComboBox1.getSelectedIndex())[0] +",[album]="+Albums.get(jComboBox2.getSelectedIndex())[0]+
                            ",[letra]='"+jTextArea1.getText().trim()+"',[presentacion]='"+jTextField2.getText().trim()+"' "
                            + "WHERE [id_cancion]="+CancionActual.Id);
                                        
                    CancionActual.Nombre=jTextField1.getText().trim();
                    CancionActual.Autor=(Integer)Artistas.get(jComboBox1.getSelectedIndex())[0];
                    CancionActual.Album=(Integer)Albums.get(jComboBox2.getSelectedIndex())[0];
                    CancionActual.Letra=jTextArea1.getText().trim();
                    CancionActual.PP=jTextField2.getText().trim();
                    jButton4.setEnabled(false);
                    JOptionPane.showMessageDialog( jInternalFrame1,
                        "La canción se ha modificado exitosamente.",
                        "Guardar Canción",
                    JOptionPane.INFORMATION_MESSAGE);
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }
            CerrarConexion(con);
        }        
    }
    
    private void NuevaCancion(){
        CancionActual=null;
        jComboBox1.setSelectedIndex(0);
        jComboBox2.setSelectedIndex(0);
        jTextField1.setText("");
        jTextField2.setText("");
        jTextArea1.setText("");
        jButton4.setEnabled(false);
        jList1.removeAll();        
    }
    
    public void ConsultarLetra(){
        if(!jTextArea1.getText().isEmpty()){
            try {
                jList1.removeAll();
                Connection con=AbrirConexion();
                Statement st=con.createStatement();
                DefaultListModel model = new DefaultListModel();
                ConsultaLetra.clear();
                      
                String query="SELECT CANCION.* "
                        + "FROM CANCION "
                        + "WHERE letra LIKE ? "
                        + "ORDER BY nombre;";
                
                PreparedStatement ps = con.prepareStatement(query);
                ps.setString(1, "%" + jTextArea1.getText().trim() + "%");
                ResultSet rs=ps.executeQuery();
                while ( rs.next() )
                {
                    Cancion nueva=new Cancion();
                    nueva.Id=rs.getInt(1);
                    nueva.Nombre=rs.getString(2);
                    nueva.Autor=rs.getInt(3);
                    nueva.Album=rs.getInt(4);
                    nueva.Letra=rs.getString(5);
                    nueva.PP=rs.getString(6);
                    ConsultaLetra.add(nueva);
                    
                    String nombre="(sin nombre)";
                    if(!nueva.Nombre.isEmpty())
                        nombre=nueva.Nombre;
                    
                    //jList1.add(nombre+" - "+nueva.Letra);                    
                    model.add(model.getSize(),nombre+" - "+nueva.Letra.replace("\n", ", "));                      
                }
                jList1.setModel(model);
               
                CerrarConexion(con);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }else{
            jList1.removeAll();
        }
    }
    
    public JTextArea getAreaTexto(){return jTextArea1;}
    
    public void LimpiarListaConsulta(){
        DefaultListModel model = new DefaultListModel();
        jList1.setModel(model);
    }
    
    private void SeleccionarDatoConsultaLetra(){
        if(jList1.getModel().getSize()>0 && jList1.getSelectedIndex()!=-1){
            CancionActual=ConsultaLetra.get(jList1.getSelectedIndex());
            jTextField1.setText(CancionActual.Nombre);
            jTextField2.setText(CancionActual.PP);
            jComboBox1.setSelectedIndex(CancionActual.Autor);
            jComboBox2.setSelectedIndex(CancionActual.Album);
            jTextArea1.setText(CancionActual.Letra);
            jButton4.setEnabled(false);
        }
    }
    
    public void CambiarTamañoForm(){
        if(jToggleButton1.isSelected()){
            jToggleButton1.setText("Menos...");        
            while(getHeight()<FORM_EXTENDIDO){
                setSize(getWidth(), getHeight()+2);
                try {
                    Thread.sleep(1);
                } catch (InterruptedException ex) {
                    Logger.getLogger(LyricsHandler_P.class.getName()).log(Level.SEVERE, null, ex);
                }            
            }
        }else{
            jToggleButton1.setText("Más...");
            while(getHeight()>FORM_REDUCIDO){
                setSize(getWidth(), getHeight()-2);
                try {
                    Thread.sleep(1);
                } catch (InterruptedException ex) {
                    Logger.getLogger(LyricsHandler_P.class.getName()).log(Level.SEVERE, null, ex);
                }            
            }
        }
        setLocationRelativeTo(null);
    }
    
    public void CambioPestañas(){
        if(jTabbedPane1.getSelectedIndex()==1 && jToggleButton1.isSelected()){            
            jToggleButton1.setText("Más...");            
            jToggleButton1.setSelected(false);
            setSize(getWidth(),FORM_REDUCIDO);            
        }
    }
    
    public void ConsultaEspecifica(){        
        if(!jRadioButton2.isSelected())
            jTextField5.setEnabled(false);
        if(jRadioButton1.isSelected()){
            ConsultaEspecifica=new LinkedList();
            jTextField5.setText("");            
            try {                
                Connection con=AbrirConexion();                
                DefaultTableModel model = new DefaultTableModel() {
                    @Override
                    public boolean isCellEditable(int rowIndex, int mColIndex) {
                        return false;
                    }
                };
                model.addColumn("Artista");
                model.addColumn("Álbum");
                model.addColumn("Nombre");
                model.addColumn("Letra");
                      
                String query=
                        "SELECT ARTISTA.id_artista, ARTISTA.nombre as NombreArtista , "
                        + "ALBUM.id_album, ALBUM.nombre as NombreAlbum, CANCION.id_cancion, "
                        + "CANCION.nombre as NombreCancion, CANCION.letra, CANCION.presentacion "
                        + "FROM ARTISTA, ALBUM, CANCION "
                        + "WHERE ARTISTA.id_artista=CANCION.autor "
                        + "AND ALBUM.id_album=CANCION.album "
                        + "AND (ARTISTA.id_artista=0 "
                        + "OR ALBUM.id_album=0 "
                        + "OR CANCION.nombre='') "
                        + "ORDER BY ARTISTA.nombre;";
                
                PreparedStatement ps = con.prepareStatement(query);                
                ResultSet rs=ps.executeQuery();
                while ( rs.next() )
                {
                    Cancion nueva=new Cancion();
                    nueva.Id=rs.getInt(5);
                    nueva.Nombre=rs.getString(6);
                    nueva.Autor=rs.getInt(1);
                    nueva.Album=rs.getInt(3);
                    nueva.Letra=rs.getString(7);
                    nueva.PP=rs.getString(8);
                    ConsultaEspecifica.add(nueva);
                    model.addRow(new String[]{rs.getString(2),rs.getString(4),nueva.Nombre,nueva.Letra});                                                            
                }
                jTable1.setModel(model);
               
                CerrarConexion(con);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }else if(jRadioButton2.isSelected()){            
            if(!jTextField5.getText().isEmpty()){
                ConsultaEspecifica=new LinkedList();
                try {                
                    Connection con=AbrirConexion();                
                    DefaultTableModel model = new DefaultTableModel() {
                        @Override
                        public boolean isCellEditable(int rowIndex, int mColIndex) {
                            return false;
                        }
                    };
                    model.addColumn("Artista");
                    model.addColumn("Álbum");
                    model.addColumn("Nombre");
                    model.addColumn("Letra");

                    String query=
                        "SELECT ARTISTA.id_artista, ARTISTA.nombre as NombreArtista , "
                        + "ALBUM.id_album, ALBUM.nombre as NombreAlbum, CANCION.id_cancion, "
                        + "CANCION.nombre as NombreCancion, CANCION.letra, CANCION.presentacion "
                        + "FROM ARTISTA, ALBUM, CANCION "
                        + "WHERE ARTISTA.id_artista=CANCION.autor "
                        + "AND ALBUM.id_album=CANCION.album "
                        + "AND CANCION.nombre LIKE ?;";

                    PreparedStatement ps = con.prepareStatement(query);                
                    ps.setString(1, "%"+jTextField5.getText().trim()+"%");
                    ResultSet rs=ps.executeQuery();
                    while ( rs.next() )
                    {
                        Cancion nueva=new Cancion();
                    nueva.Id=rs.getInt(5);
                    nueva.Nombre=rs.getString(6);
                    nueva.Autor=rs.getInt(1);
                    nueva.Album=rs.getInt(3);
                    nueva.Letra=rs.getString(7);
                    nueva.PP=rs.getString(8);
                    ConsultaEspecifica.add(nueva);
                    model.addRow(new String[]{rs.getString(2),rs.getString(4),nueva.Nombre,nueva.Letra});
                    }
                    jTable1.setModel(model);

                    CerrarConexion(con);
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }
        }else if(jRadioButton3.isSelected())      {
            ConsultaEspecifica=new LinkedList();
            try {                
                Connection con=AbrirConexion();                
                DefaultTableModel model = new DefaultTableModel() {
                    @Override
                    public boolean isCellEditable(int rowIndex, int mColIndex) {
                        return false;
                    }
                };
                model.addColumn("Artista");
                model.addColumn("Álbum");
                model.addColumn("Nombre");
                model.addColumn("Letra");

                String query=
                    "SELECT ARTISTA.id_artista, ARTISTA.nombre as NombreArtista , "
                    + "ALBUM.id_album, ALBUM.nombre as NombreAlbum, CANCION.id_cancion, "
                    + "CANCION.nombre as NombreCancion, CANCION.letra, CANCION.presentacion "
                    + "FROM ARTISTA, ALBUM, CANCION "
                    + "WHERE ARTISTA.id_artista=CANCION.autor "
                    + "AND ALBUM.id_album=CANCION.album "
                    + "AND CANCION.letra LIKE ?;";

                PreparedStatement ps = con.prepareStatement(query);                
                ps.setString(1, "%****%");
                ResultSet rs=ps.executeQuery();
                while ( rs.next() )
                {
                    Cancion nueva=new Cancion();
                    nueva.Id=rs.getInt(5);
                    nueva.Nombre=rs.getString(6);
                    nueva.Autor=rs.getInt(1);
                    nueva.Album=rs.getInt(3);
                    nueva.Letra=rs.getString(7);
                    nueva.PP=rs.getString(8);
                    ConsultaEspecifica.add(nueva);
                    model.addRow(new String[]{rs.getString(2),rs.getString(4),nueva.Nombre,nueva.Letra});
                }
                jTable1.setModel(model);

                CerrarConexion(con);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }else if(jRadioButton4.isSelected())      {
            ConsultaEspecifica=new LinkedList();
            try {                
                Connection con=AbrirConexion();                
                DefaultTableModel model = new DefaultTableModel() {
                    @Override
                    public boolean isCellEditable(int rowIndex, int mColIndex) {
                        return false;
                    }
                };
                model.addColumn("Artista");
                model.addColumn("Álbum");
                model.addColumn("Nombre");
                model.addColumn("Letra");

                String query=
                    "SELECT ARTISTA.id_artista, ARTISTA.nombre as NombreArtista , "
                    + "ALBUM.id_album, ALBUM.nombre as NombreAlbum, CANCION.id_cancion, "
                    + "CANCION.nombre as NombreCancion, CANCION.letra, CANCION.presentacion "
                    + "FROM ARTISTA, ALBUM, CANCION "
                    + "WHERE ARTISTA.id_artista=CANCION.autor "
                    + "AND ALBUM.id_album=CANCION.album;";

                PreparedStatement ps=con.prepareStatement(query);
                ResultSet rs=ps.executeQuery();
                while ( rs.next() )
                {
                    Cancion nueva=new Cancion();
                    nueva.Id=rs.getInt(5);
                    nueva.Nombre=rs.getString(6);
                    nueva.Autor=rs.getInt(1);
                    nueva.Album=rs.getInt(3);
                    nueva.Letra=rs.getString(7);
                    nueva.PP=rs.getString(8);
                    ConsultaEspecifica.add(nueva);
                    model.addRow(new String[]{rs.getString(2),rs.getString(4),nueva.Nombre,nueva.Letra});
                }
                jTable1.setModel(model);

                CerrarConexion(con);
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }else if(jRadioButton5.isSelected()){            
            if(!jTextField5.getText().isEmpty()){
                ConsultaEspecifica=new LinkedList();
                try {                
                    Connection con=AbrirConexion();                
                    DefaultTableModel model = new DefaultTableModel() {
                        @Override
                        public boolean isCellEditable(int rowIndex, int mColIndex) {
                            return false;
                        }
                    };
                    model.addColumn("Artista");
                    model.addColumn("Álbum");
                    model.addColumn("Nombre");
                    model.addColumn("Letra");

                    String query=
                        "SELECT ARTISTA.id_artista, ARTISTA.nombre as NombreArtista , "
                        + "ALBUM.id_album, ALBUM.nombre as NombreAlbum, CANCION.id_cancion, "
                        + "CANCION.nombre as NombreCancion, CANCION.letra, CANCION.presentacion "
                        + "FROM ARTISTA, ALBUM, CANCION "
                        + "WHERE CANCION.presentacion='' ;";

                    PreparedStatement ps = con.prepareStatement(query);                
                    ps.setString(1, "%"+jTextField5.getText().trim()+"%");
                    ResultSet rs=ps.executeQuery();
                    while ( rs.next() )
                    {
                        Cancion nueva=new Cancion();
                    nueva.Id=rs.getInt(5);
                    nueva.Nombre=rs.getString(6);
                    nueva.Autor=rs.getInt(1);
                    nueva.Album=rs.getInt(3);
                    nueva.Letra=rs.getString(7);
                    nueva.PP=rs.getString(8);
                    ConsultaEspecifica.add(nueva);
                    model.addRow(new String[]{rs.getString(2),rs.getString(4),nueva.Nombre,nueva.Letra});
                    }
                    jTable1.setModel(model);

                    CerrarConexion(con);
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }
        }
    }
    
    private void SeleccionarDatoConsultaEspecifica(){
        if(jTable1.getSelectedRow()!=-1){
            CancionActual=ConsultaEspecifica.get(jTable1.getSelectedRow());
            jTextField1.setText(CancionActual.Nombre);
            jTextField2.setText(CancionActual.PP);
            jComboBox1.setSelectedIndex(CancionActual.Autor);
            jComboBox2.setSelectedIndex(CancionActual.Album);
            jTextArea1.setText(CancionActual.Letra);
            jTabbedPane1.setSelectedIndex(0);
            jButton4.setEnabled(false);
        }
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jToggleButton1 = new javax.swing.JToggleButton();
        jPanel2 = new javax.swing.JPanel();
        jTextField2 = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jComboBox2 = new javax.swing.JComboBox();
        jTextField1 = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jTextField5 = new javax.swing.JTextField();
        jRadioButton3 = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        jRadioButton5 = new javax.swing.JRadioButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jInternalFrame1 = new javax.swing.JInternalFrame();
        jLabel6 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jButton6 = new javax.swing.JButton();
        jInternalFrame2 = new javax.swing.JInternalFrame();
        jLabel7 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jButton7 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Lyrics Handler");
        setResizable(false);

        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jTabbedPane1StateChanged(evt);
            }
        });

        jToggleButton1.setText("Mas...");
        jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton1ActionPerformed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Edición"));

        jTextField2.setEditable(false);
        jTextField2.setText("jTextField2");
        jTextField2.setToolTipText("Haz doble click para abrir la presentación");
        jTextField2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextField2MouseClicked(evt);
            }
        });

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/1326222704_pptx_win.png"))); // NOI18N
        jButton3.setToolTipText("Buscar Power Point");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextArea1KeyTyped(evt);
            }
        });
        jScrollPane1.setViewportView(jTextArea1);

        jLabel5.setText("Presentación Power Point:");

        jLabel4.setText("Letra:");

        jLabel3.setText("Nombre:");

        jLabel2.setText("Album:");

        jLabel1.setText("Artista:");

        jComboBox1.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBox1ItemStateChanged(evt);
            }
        });

        jComboBox2.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBox2ItemStateChanged(evt);
            }
        });

        jTextField1.setText("jTextField1");
        jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextField1KeyTyped(evt);
            }
        });

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/1326221688_Plus__Orange.png"))); // NOI18N
        jButton2.setToolTipText("Agregar Álbum");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/1326221688_Plus__Orange.png"))); // NOI18N
        jButton1.setToolTipText("Agregar artista");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/1326221895_3floppy_unmount.png"))); // NOI18N
        jButton4.setToolTipText("Guardar");
        jButton4.setEnabled(false);
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/1326222040_Close_Box_Red.png"))); // NOI18N
        jButton5.setToolTipText("Eiminar");
        jButton5.setEnabled(false);
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/1326739648_document-new.png"))); // NOI18N
        jButton8.setToolTipText("Nueva Canción");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jButton5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 54, Short.MAX_VALUE))
                    .addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton3))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jComboBox2, 0, 231, Short.MAX_VALUE)
                                    .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.TRAILING, 0, 231, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel1)
                            .addComponent(jComboBox1)
                            .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jComboBox2, javax.swing.GroupLayout.DEFAULT_SIZE, 22, Short.MAX_VALUE)
                            .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 22, Short.MAX_VALUE)
                            .addComponent(jLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addGap(17, 17, 17)
                                .addComponent(jLabel4))
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(21, 21, 21))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jButton3))
                .addContainerGap())
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Coincidencias"));

        jList1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList1MouseClicked(evt);
            }
        });
        jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList1ValueChanged(evt);
            }
        });
        jScrollPane2.setViewportView(jList1);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(198, 198, 198)
                .addComponent(jToggleButton1)
                .addContainerGap(302, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(116, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addComponent(jToggleButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(86, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("", new javax.swing.ImageIcon(getClass().getResource("/RES/1326383776_filenew.png")), jPanel1); // NOI18N

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Búsqueda de Canciones"));

        jPanel7.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        buttonGroup1.add(jRadioButton1);
        jRadioButton1.setSelected(true);
        jRadioButton1.setText("Canciones con datos faltantes");
        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton1ActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton2);
        jRadioButton2.setText("Nombre de la canción");
        jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton2ActionPerformed(evt);
            }
        });

        jTextField5.setText("jTextField5");
        jTextField5.setEnabled(false);

        buttonGroup1.add(jRadioButton3);
        jRadioButton3.setText("Canciones con elementos desconocidos");
        jRadioButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton3ActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton4);
        jRadioButton4.setText("Ver todos");
        jRadioButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton4ActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton5);
        jRadioButton5.setText("Canciones sin presentación ");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jRadioButton5)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton1)
                            .addComponent(jRadioButton3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton4)
                            .addComponent(jRadioButton2)))
                    .addComponent(jTextField5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButton1)
                    .addComponent(jRadioButton2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButton3)
                    .addComponent(jRadioButton4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jRadioButton5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jScrollPane3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jScrollPane3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jScrollPane3MouseClicked(evt);
            }
        });

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Artista", "Álbum", "Titulo", "Letra"
            }
        ));
        jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable1MouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(jTable1);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 386, Short.MAX_VALUE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(135, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(239, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("", new javax.swing.ImageIcon(getClass().getResource("/RES/1326822487_Binoculars.png")), jPanel5); // NOI18N

        jTabbedPane1.setBounds(0, 0, 620, 730);
        jDesktopPane1.add(jTabbedPane1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jInternalFrame1.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jInternalFrame1.setTitle("Crear Artista");
        jInternalFrame1.addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
            public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
                jInternalFrame1InternalFrameClosed(evt);
            }
            public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
            }
        });
        jInternalFrame1.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jInternalFrame1ComponentHidden(evt);
            }
        });

        jLabel6.setText("Nombre del Artista:");

        jTextField3.setText("jTextField3");

        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/1326384570_musician.png"))); // NOI18N
        jButton6.setToolTipText("Guardar artista");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
        jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
        jInternalFrame1Layout.setHorizontalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(25, 25, 25)
                .addComponent(jButton6)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jInternalFrame1Layout.setVerticalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jInternalFrame1Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addGap(11, 11, 11)
                        .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButton6))
                .addContainerGap(19, Short.MAX_VALUE))
        );

        jInternalFrame1.setBounds(0, 0, 296, 120);
        jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jInternalFrame2.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jInternalFrame2.setTitle("Crear Álbum");
        jInternalFrame2.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jInternalFrame2ComponentHidden(evt);
            }
        });

        jLabel7.setText("Nombre del Album:");

        jTextField4.setText("jTextField4");

        jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/1326384822_diagram-25.png"))); // NOI18N
        jButton7.setToolTipText("Guardar albúm");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jInternalFrame2Layout = new javax.swing.GroupLayout(jInternalFrame2.getContentPane());
        jInternalFrame2.getContentPane().setLayout(jInternalFrame2Layout);
        jInternalFrame2Layout.setHorizontalGroup(
            jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrame2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jButton7)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jInternalFrame2Layout.setVerticalGroup(
            jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrame2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton7)
                    .addGroup(jInternalFrame2Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(19, Short.MAX_VALUE))
        );

        jInternalFrame2.setBounds(0, 0, 289, 120);
        jDesktopPane1.add(jInternalFrame2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 587, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jDesktopPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 577, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 649, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(2, 2, 2)
                    .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
    jInternalFrame2.setSize(jInternalFrame2.getPreferredSize());
    jInternalFrame2.show();
    jInternalFrame2.setLocation((getWidth()-jInternalFrame2.getWidth())/2, (getHeight()-jInternalFrame2.getHeight())/2);
}//GEN-LAST:event_jButton2ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:    
    SeleccionarPresentacion();
}//GEN-LAST:event_jButton3ActionPerformed

private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed
// TODO add your handling code here:
    CambiarTamañoForm();   
}//GEN-LAST:event_jToggleButton1ActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    jInternalFrame1.setSize(jInternalFrame1.getPreferredSize());
    jInternalFrame1.setLocation((getWidth()-jInternalFrame1.getWidth())/2, (getHeight()-jInternalFrame1.getHeight())/2);
    jInternalFrame1.show();
}//GEN-LAST:event_jButton1ActionPerformed

private void jInternalFrame1InternalFrameClosed(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_jInternalFrame1InternalFrameClosed
// TODO add your handling code here:
    
}//GEN-LAST:event_jInternalFrame1InternalFrameClosed

private void jInternalFrame1ComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jInternalFrame1ComponentHidden
// TODO add your handling code here:
    jTextField3.setText("");
}//GEN-LAST:event_jInternalFrame1ComponentHidden

private void jInternalFrame2ComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jInternalFrame2ComponentHidden
// TODO add your handling code here:
    jTextField4.setText("");
}//GEN-LAST:event_jInternalFrame2ComponentHidden

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:        
    GuardarCancion();        
}//GEN-LAST:event_jButton4ActionPerformed

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// TODO add your handling code here:
    AgregarArtista();
}//GEN-LAST:event_jButton6ActionPerformed

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
// TODO add your handling code here:
    AgregarAlbum();
}//GEN-LAST:event_jButton7ActionPerformed

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
// TODO add your handling code here:
    NuevaCancion();    
}//GEN-LAST:event_jButton8ActionPerformed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton5ActionPerformed

private void jTextField2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField2MouseClicked
// TODO add your handling code here:
    if(evt.getClickCount()==2 && !jTextField2.getText().isEmpty()){
        try{
                File path = new File(jTextField2.getText().trim());
                path.setReadOnly();
                path.setExecutable(true);
                Desktop.getDesktop().open(path);
                setTitle("Lyrics Handler - Abriendo...");
                Thread.sleep(2000);
                setTitle("Lyrics Handler");
        }catch(Exception e){
            JOptionPane.showMessageDialog( this,
                "No ha sido posible abrir el archivo indicado. Es probable\n" +
                "que se haya cambiado de ubicación o que ha sido borrado.",
                "Error al Abrir",
                JOptionPane.ERROR_MESSAGE);
        }
    }
}//GEN-LAST:event_jTextField2MouseClicked

private void jTextArea1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextArea1KeyTyped
// TODO add your handling code here:
    Temporizador.Contador=0;    
    jButton4.setEnabled(true);
}//GEN-LAST:event_jTextArea1KeyTyped

private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged
// TODO add your handling code here:    
    
}//GEN-LAST:event_jList1ValueChanged

private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked
// TODO add your handling code here:
    if(evt.getClickCount()==2)
        SeleccionarDatoConsultaLetra();
}//GEN-LAST:event_jList1MouseClicked

private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
// TODO add your handling code here:
    CambioPestañas();
}//GEN-LAST:event_jTabbedPane1StateChanged

private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
// TODO add your handling code here:
    
    if(jRadioButton2.isSelected())
        jTextField5.setEnabled(true);        
    else
        ConsultaEspecifica();
}//GEN-LAST:event_jRadioButton1ActionPerformed

private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
// TODO add your handling code here:
    if(jRadioButton2.isSelected())
        jTextField5.setEnabled(true);        
    else
        ConsultaEspecifica();
}//GEN-LAST:event_jRadioButton2ActionPerformed

private void jScrollPane3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane3MouseClicked
// TODO add your handling code here:
    
}//GEN-LAST:event_jScrollPane3MouseClicked

private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
// TODO add your handling code here:
    if(evt.getClickCount()==2){
        SeleccionarDatoConsultaEspecifica();
    }
}//GEN-LAST:event_jTable1MouseClicked

private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed
// TODO add your handling code here:
    if(jRadioButton2.isSelected())
        jTextField5.setEnabled(true);        
    else
        ConsultaEspecifica();
}//GEN-LAST:event_jRadioButton3ActionPerformed

private void jRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton4ActionPerformed
// TODO add your handling code here:
    if(jRadioButton2.isSelected())
        jTextField5.setEnabled(true);        
    else
        ConsultaEspecifica();
}//GEN-LAST:event_jRadioButton4ActionPerformed

private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox1ItemStateChanged
// TODO add your handling code here:
    jButton4.setEnabled(true);
}//GEN-LAST:event_jComboBox1ItemStateChanged

private void jComboBox2ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox2ItemStateChanged
// TODO add your handling code here:
    jButton4.setEnabled(true);
}//GEN-LAST:event_jComboBox2ItemStateChanged

private void jTextField1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyTyped
// TODO add your handling code here:
    jButton4.setEnabled(true);
}//GEN-LAST:event_jTextField1KeyTyped

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(LyricsHandler_P.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(LyricsHandler_P.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(LyricsHandler_P.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(LyricsHandler_P.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new LyricsHandler_P().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JInternalFrame jInternalFrame1;
    private javax.swing.JInternalFrame jInternalFrame2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JList jList1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JRadioButton jRadioButton5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JToggleButton jToggleButton1;
    // End of variables declaration//GEN-END:variables
}
